#ifndef CONFIG_H
#define CONFIG_H

#include <QObject>
#include <QtCore>
#include<QDataStream>
#include <QFile>
#include <QXmlStreamReader>
#include <QDebug>
#include<QSettings>
class config : public QObject
{
    Q_OBJECT


public:
    explicit config(QObject *parent = 0);

private :

    QString img_file_cnf;
    QFile conf_file;
    QString config_post_scheme;
    QString tribunenumber;
    QStringList board_num;
    QStringList add;
    QStringList xml_path;
    QStringList post_path;
    QStringList post_scheme_cn;
    QDataStream out;
    QString test_add;
    QString test_xml_path;
    QString test_post_path;
    QString test_post_scheme_cn;
    QString test_user_agent;
    QString test_cookie;
    QString company;
    QString application_name;
    QString browser;
    bool found_board_num(int numboard);
    //QStringList board_add;


signals:
    //Envoi vers config ou a l'ouverture du programme
    void send_board_add(QString,int);
    void send_board_filexml_path(QString);
    void send_board_post_path(QString);
    void send_board_cookie(QString);
    void send_board_message_fl(QString);
    void send_parameters_to_cnf(QString url_xml,QString url_post,QString cookie,QString post_scheme,int number);
public slots:
    void sauvegarde_config(QString url_xml,QString url_post,QString cookie,QString post_scheme,int number);
    void lecture_config(void);
    void write_net_settings(QString add_proxy, QString proxy_port);
    void write_conf_board_init(void);
    void write_general_settings(void);
    //Reception des parametrs
    void receive_data_add_from_cnf(QString data);
    void receive_data_xml_path_from_cnf(QString data);
    void receive_data_post_path_from_cnf(QString data);
    void receive_data_user_agent_from_cnf(QString data);
    void receive_data_post_scheme_from_cnf(QString data);
    void receive_data_cookie_from_cnf(QString data);
    //TODO finir le reste pour les autres parametres
    void read_conf(void);
    
};

#endif // CONFIG_H
